const STORAGE_KEY = 'long-mes'
let storeFun={
    getStorage(){
        let object=window.sessionStorage.getItem(STORAGE_KEY)||'{}'
        let data=JSON.parse(object)
        return data
    },
    clear(){
        window.sessionStorage.setItem(STORAGE_KEY,'')
    },
    save(key,val){
        let storage=storeFun.getStorage()
        storage[key] = val
        window.sessionStorage.setItem(STORAGE_KEY,JSON.stringify(storage))
    },
    fetch(key){
        return storeFun.getStorage()[key]
    }
}

export default storeFun
